home *** CD-ROM | disk | FTP | other *** search
/ Amiga Games: 500 MB Amiga Software / 500 MB Amiga Software - Euber 130 - Amiga Games Disc & Mag.iso / userbox / publicdomain / datatypes / multiprint / source / init.c next >
C/C++ Source or Header  |  1995-08-09  |  1KB  |  58 lines

  1. /*
  2. ** $PROJECT: MultiPrint - print datatype objects
  3. **
  4. ** $VER: Init.c 39.0 (07.08.95)
  5. **
  6. ** by
  7. **
  8. ** Stefan Ruppert , Windthorststrasse 5 , 65439 Floersheim , GERMANY
  9. **
  10. ** (C) Copyright 1995
  11. ** All Rights Reserved !
  12. **
  13. ** $HISTORY:
  14. **
  15. ** 07.08.95 : 039.000 : initial
  16. */
  17.  
  18. /* ------------------------------- includes ------------------------------- */
  19.  
  20. #include "MultiPrint.h"
  21.  
  22. /* ------------------------------ definition ------------------------------ */
  23.  
  24. #define PUDDLE_SIZE     4096
  25. #define THRESH_SIZE     4096
  26.  
  27. /* ---------------------------- init function ----------------------------- */
  28.  
  29. void Free(struct GlobalData *gd)
  30. {
  31.     DeletePool(gd->gd_Pool);
  32. }
  33.  
  34. #undef SysBase
  35.  
  36. struct GlobalData *Init(void)
  37. {
  38.     struct Library *SysBase = *((struct Library **) 4L);
  39.     struct GlobalData *gd = NULL;
  40.     APTR pool;
  41.  
  42.     if(SysBase->lib_Version >= 39)
  43.     {
  44.         if((pool = CreatePool(MEMF_ANY | MEMF_CLEAR,PUDDLE_SIZE,THRESH_SIZE)) != NULL)
  45.         {
  46.             if((gd = AllocPooled(pool,sizeof(struct GlobalData))) != NULL)
  47.             {
  48.                 gd->gd_SysBase = SysBase;
  49.                 gd->gd_Pool    = pool;
  50.             } else
  51.                 DeletePool(pool);
  52.         }
  53.     }
  54.  
  55.     return(gd);
  56. }
  57.  
  58.